<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>库存预警</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right"><!--右侧内容-->
					<div class="rigtop">
						<span class="title">预警值{$yj}</span>
					</div>
					<div class="indrig_con" style="position: relative;">
						<div class="zizh_btnbox" style="top: -58px;right: 20px;">
							<button class="zizh_btn" type="button" onclick="set_yj()"><i class="iconfont icon-jia"></i>设置</button>
						</div>
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<form id="my_form" action="" method="post">
							<div class="zizh_con_1">
								<div class="chax_rowbox clearfix">
									<div class="chax_rowbox clearfix">
										<div class="shxx_row clearfix">
							            <div class="left">商品编号：</div>
							            <div class="right clearfix">
											<input type="text" name="goods_no" placeholder="输入商品编号" class="chax_input" />
							            </div>
						        	</div>
							        
							        <div class="shxx_row clearfix">
							             <button  type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
							        </div>
								</div>
								</form>
								<div class="chax_conbox">
									<div class="chax_jiegnr">
										<table class="zizh_table1 zizh_table2">
											<thead>
												<tr>
													<th  class="w_20">商品编号</th>
													<th class="w_20">商品名称</th>
													<th class="w_10">库存</th>
													<th class="w_20">添加时间</th>
												</tr>
											</thead>
											<tbody id="tbody">
												{volist name="list" id="vo" empty="$empty"}
												<tr>
													<td>{$vo.goods_no}</td>
													<td>{$vo.goods_name}</td>
													<td>{$vo.stock}</td>
													<td>
														{$vo.addtime}
													</td>
												</tr>
												{/volist}
											</tbody>
										</table>
										<div class="fenye" style="display: block;">
											<ul class="pagination">
												{$list->render()}
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}
	</body>

</html>
<script>
	function set_yj(){
		layer.prompt({
		  formType: 0,
		  value: '{$yj}',
		  title: '请输入预警值'
		}, function(value, index, elem){
			if(isNaN(value)){
				alert("请输入正确的预警值");
				return ;
			}
			if(value < 0){
				alert("预警值不可小于零");
				return ;
			}
			$.ajax({
				type: "post",
				url: "{:url('shop/set_yj')}",
				data: {value:value}, //表单数据
				success: function(data) {
					layer.msg(data.msg, {
						icon: 1,
						time: 1500 //2秒关闭（如果不配置，默认是3秒）
					}, function() {
						window.parent.location.reload();
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
						parent.layer.close(index);
					});
				}
			});
		});
	}
</script>